package org.devgframwork.demo.rabbitmq;

import org.devgframwork.rabbitmq.RabbitComponent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description
 * @auther dh
 * @date 2022/4/14 9:20
 */

@RestController
@RequestMapping(value = "/test/rabbitmq")
public class RabbitController {

    @Autowired
    private RabbitComponent rabbitComponent;

    @RequestMapping(value = "/sendDirectMsg", method = RequestMethod.GET)
    public String sendDirectMsg() throws Exception {
        String msg = "你好Direct123456";
        rabbitComponent.basicPublish("direct_exchange", "direct_consumer", null, msg);
        return "success";
    }

}
